package com.example.gsnd21study.web;

import com.example.gsnd21study.entity.Student;
import com.example.gsnd21study.utils.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class testController {

    @RequestMapping("/hello")
    public void hello() {
        System.out.println("hello");
    }

    @RequestMapping("/test1")
    public Result<String> test1(){
        return Result.success("test1");
    }

    @RequestMapping("/test2")
    public Result<Student> test2(){
        Student student = new Student();
        student.setAge(20);
        student.setSno(1L);
        student.setName("zhangsan");
        student.setGender("男");
        return Result.success(student);
    }

    @RequestMapping("/test3")
    public Result<List<Student>> test3(){
        List<Student> list = new ArrayList<Student>();
        Student student1 = new Student();
        student1.setAge(20);
        student1.setSno(1L);
        student1.setName("zhangsan");
        student1.setGender("男");
        Student student2 = new Student();
        student2.setAge(20);
        student2.setSno(1L);
        student2.setName("zhangsan");
        student2.setGender("男");
        list.add(student1);
        list.add(student2);
        return Result.success(list);
    }


}
